/*
 * PCL.h
 *
 *  Created on: 2012. 10. 15.
 *      Author: dalxx
 */

#include <Arduino.h>
#include "PLCLib/PLCConfig.h"

#ifndef PCL_H_
#define PCL_H_

#include "PLCLib/Output.h"

class PLC;
struct PLC_CMD_HANDLER
{
	void (PLC::*(Handler))();
	const char* CMD;
};

class PLC {
private:

	char full_buffer[BUFFER_SIZE];
	int nRelay;
	PLCLib::Relay** relay_list;
	int nOutput;
	PLCLib::Output **output;
	Stream* cmdConsole;
	void deleteAll();
public:

	static const char* CMD_PLC_SET;
	static const char* CMD_STOP;
	static const char* CMD_START;
	static const char* CMD_CHANG_MOD;

	static const char* OUT_OK;
	static const char* ERR_FMT_PLC_SET;


public:

	PLC(Stream& _cmdReader);
	virtual ~PLC();
	void doPLC();
	void processCommand();
	void calcuateRelay();
	void createRelay();




};

#endif /* PCL_H_ */
